package com.xinqing.test.collection.map;

import org.apache.commons.collections.map.HashedMap;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author:CHQ
 * @Date:2020/12/29 14:12
 * @Description
 */
public class PutAll {

    public static void main(String args[]) {

        HashMap<String, String> map1 = new HashMap<>();
        map1.put("1", "x");
        map1.put("2", "y");

        HashMap<String, String> map2 = new HashMap<>();
        map2.put("3", "z");
        map2.put("4", "m");

        map1.putAll(map2);//把map2的元素全部放入map1中,map1该有的元素还是有的

        for (String s : map1.keySet()) {
            System.out.println(s); //1 2 3 4
        }
    }

}
